.class public final Lcom/farmis/feedme/FeedMeMain;
.super Ljava/lang/Object;
.source "FeedMeMain.kt"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/farmis/feedme/FeedMeMain$S;
    }
.end annotation

.annotation system Ldalvik/annotation/SourceDebugExtension;
    value = "SMAP\nFeedMeMain.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FeedMeMain.kt\ncom/farmis/feedme/FeedMeMain\n+ 2 Log.kt\ncom/mcxiaoke/koi/log/LogKt\n*L\n1#1,93:1\n104#2:94\n133#2,5:95\n105#2:100\n104#2:101\n133#2,5:102\n105#2:107\n*E\n*S KotlinDebug\n*F\n+ 1 FeedMeMain.kt\ncom/farmis/feedme/FeedMeMain\n*L\n39#1:94\n39#1,5:95\n39#1:100\n51#1:101\n51#1,5:102\n51#1:107\n*E\n"
.end annotation


# static fields
.field public static final S:Lcom/farmis/feedme/FeedMeMain$S;

.field private static parentInterface:Lcom/farmis/feedme/java_interfaces/OnReactionInterface;


# direct methods
.method static constructor <clinit>()V
    .locals 2

    new-instance v0, Lcom/farmis/feedme/FeedMeMain$S;

    const/4 v1, 0x0

    invoke-direct {v0, v1}, Lcom/farmis/feedme/FeedMeMain$S;-><init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V

    sput-object v0, Lcom/farmis/feedme/FeedMeMain;->S:Lcom/farmis/feedme/FeedMeMain$S;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .line 20
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static final synthetic access$getParentInterface$cp()Lcom/farmis/feedme/java_interfaces/OnReactionInterface;
    .locals 1

    .line 20
    sget-object v0, Lcom/farmis/feedme/FeedMeMain;->parentInterface:Lcom/farmis/feedme/java_interfaces/OnReactionInterface;

    return-object v0
.end method

.method public static final synthetic access$setParentInterface$cp(Lcom/farmis/feedme/java_interfaces/OnReactionInterface;)V
    .locals 0

    .line 20
    sput-object p0, Lcom/farmis/feedme/FeedMeMain;->parentInterface:Lcom/farmis/feedme/java_interfaces/OnReactionInterface;

    return-void
.end method

.method private final isNetworkConnected(Landroidx/fragment/app/FragmentActivity;)Z
    .locals 1

    const-string v0, "connectivity"

    .line 88
    invoke-virtual {p1, v0}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p1

    if-eqz p1, :cond_1

    check-cast p1, Landroid/net/ConnectivityManager;

    .line 89
    invoke-virtual {p1}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object p1

    if-eqz p1, :cond_0

    const/4 p1, 0x1

    goto :goto_0

    :cond_0
    const/4 p1, 0x0

    :goto_0
    return p1

    .line 88
    :cond_1
    new-instance p1, Lkotlin/TypeCastException;

    const-string v0, "null cannot be cast to non-null type android.net.ConnectivityManager"

    invoke-direct {p1, v0}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V

    throw p1
.end method

.method private final runIfTriggered(Landroidx/fragment/app/FragmentActivity;Lkotlin/jvm/functions/Function0;)Z
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroidx/fragment/app/FragmentActivity;",
            "Lkotlin/jvm/functions/Function0<",
            "Lkotlin/Unit;",
            ">;)Z"
        }
    .end annotation

    .line 75
    sget-object v0, Lcom/farmis/feedme/triggers/QuestionNumberTrigger;->INSTANCE:Lcom/farmis/feedme/triggers/QuestionNumberTrigger;

    invoke-virtual {v0, p1}, Lcom/farmis/feedme/triggers/QuestionNumberTrigger;->isTriggered(Landroid/content/Context;)Z

    move-result v0

    const/4 v1, 0x0

    if-eqz v0, :cond_0

    .line 76
    invoke-static {p1}, Lcom/farmis/feedme/utils/UtilsKt;->sp(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v0

    invoke-static {}, Lcom/farmis/feedme/TriggersKt;->getKEY_IS_ACTIVE()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v3

    invoke-static {v0, v2, v3}, Lcom/farmis/feedme/utils/UtilsKt;->set(Landroid/content/SharedPreferences;Ljava/lang/String;Ljava/lang/Object;)V

    .line 78
    :cond_0
    sget-object v0, Lcom/farmis/feedme/Triggers;->INSTANCE:Lcom/farmis/feedme/Triggers;

    invoke-virtual {v0, p1}, Lcom/farmis/feedme/Triggers;->isTriggered(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-direct {p0, p1}, Lcom/farmis/feedme/FeedMeMain;->isNetworkConnected(Landroidx/fragment/app/FragmentActivity;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 79
    invoke-static {p1}, Lcom/farmis/feedme/utils/UtilsKt;->sp(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object p1

    invoke-static {}, Lcom/farmis/feedme/TriggersKt;->getKEY_IS_ACTIVE()Ljava/lang/String;

    move-result-object v0

    invoke-interface {p1, v0, v1}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result p1

    if-nez p1, :cond_1

    .line 80
    invoke-interface {p2}, Lkotlin/jvm/functions/Function0;->invoke()Ljava/lang/Object;

    const/4 p1, 0x1

    return p1

    :cond_1
    return v1
.end method


# virtual methods
.method public final init(Landroid/content/Context;Lcom/farmis/feedme/Conf;Lcom/farmis/feedme/java_interfaces/OnReactionInterface;)V
    .locals 1

    const-string v0, "context"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v0, "conf"

    invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v0, "parentInterface"

    invoke-static {p3, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 27
    sget-object v0, Lcom/farmis/feedme/FeedMeMain;->S:Lcom/farmis/feedme/FeedMeMain$S;

    invoke-virtual {v0, p3}, Lcom/farmis/feedme/FeedMeMain$S;->setParentInterface(Lcom/farmis/feedme/java_interfaces/OnReactionInterface;)V

    .line 28
    sget-object p3, Lcom/farmis/feedme/Conf;->Companion:Lcom/farmis/feedme/Conf$Companion;

    invoke-virtual {p3, p2}, Lcom/farmis/feedme/Conf$Companion;->setIns(Lcom/farmis/feedme/Conf;)V

    .line 29
    sget-object p2, Lcom/farmis/feedme/triggers/OpenCountTrigger;->INSTANCE:Lcom/farmis/feedme/triggers/OpenCountTrigger;

    invoke-virtual {p2, p1}, Lcom/farmis/feedme/triggers/OpenCountTrigger;->add(Landroid/content/Context;)V

    .line 30
    sget-object p2, Lcom/farmis/feedme/triggers/QuestionNumberTrigger;->INSTANCE:Lcom/farmis/feedme/triggers/QuestionNumberTrigger;

    invoke-virtual {p2, p1}, Lcom/farmis/feedme/triggers/QuestionNumberTrigger;->add(Landroid/content/Context;)V

    return-void
.end method

.method public final showIfTriggered(Landroidx/fragment/app/FragmentActivity;)Z
    .locals 4

    const-string v0, "activity"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 50
    sget-object v0, Lcom/farmis/feedme/Conf;->Companion:Lcom/farmis/feedme/Conf$Companion;

    invoke-virtual {v0}, Lcom/farmis/feedme/Conf$Companion;->getIns()Lcom/farmis/feedme/Conf;

    move-result-object v0

    invoke-virtual {v0}, Lcom/farmis/feedme/Conf;->isEnabled()Z

    move-result v0

    if-nez v0, :cond_2

    .line 101
    invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object p1

    invoke-virtual {p1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object p1

    const-string v0, "javaClass.simpleName"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    const/4 v0, 0x0

    .line 103
    sget-object v1, Lcom/mcxiaoke/koi/KoiConfig;->Companion:Lcom/mcxiaoke/koi/KoiConfig$Companion;

    invoke-virtual {v1}, Lcom/mcxiaoke/koi/KoiConfig$Companion;->getLogLevel()I

    move-result v1

    const/4 v2, 0x5

    if-gt v1, v2, :cond_1

    .line 104
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    .line 51
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-class v3, Lcom/farmis/feedme/FeedMeMain;

    invoke-virtual {v3}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v3, " is DISABLED."

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    if-eqz v2, :cond_0

    invoke-virtual {v2}, Ljava/lang/String;->toString()Ljava/lang/String;

    move-result-object v2

    if-eqz v2, :cond_0

    goto :goto_0

    :cond_0
    const-string v2, "null"

    :goto_0
    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v2, " [T:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {}, Lcom/mcxiaoke/koi/CoreKt;->threadName()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const/16 v2, 0x5d

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {p1, v1, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    :cond_1
    const/4 p1, 0x0

    return p1

    .line 54
    :cond_2
    new-instance v0, Lcom/farmis/feedme/FeedMeMain$showIfTriggered$2;

    invoke-direct {v0, p1}, Lcom/farmis/feedme/FeedMeMain$showIfTriggered$2;-><init>(Landroidx/fragment/app/FragmentActivity;)V

    invoke-direct {p0, p1, v0}, Lcom/farmis/feedme/FeedMeMain;->runIfTriggered(Landroidx/fragment/app/FragmentActivity;Lkotlin/jvm/functions/Function0;)Z

    move-result p1

    return p1
.end method
